import gevent
from gevent import monkey
import time

#打补丁
#如果不打补丁的话，下面就必须写上gevent.sleep(0.5)
monkey.patch_all()

def a():
    while True:
        print('---1---')
        time.sleep(0.5)

def b():
    while True:
        print('---2---')
        time.sleep(0.5)

if __name__ == '__main__':
    g1 = gevent.spawn(a)
    g2 = gevent.spawn(b)

    g1.join()
    g2.join()